import { Injectable } from '@nestjs/common';
import { InjectRedis } from '@nestjs-modules/ioredis';
import Redis from 'ioredis';

@Injectable()
export class AppService {
  constructor(@InjectRedis() private readonly redis: Redis) {}
  async getHello(): Promise<string> {
    // 使用 Redis 设置值
    await this.redis.set('hello', 'Hello from Redis!');
    // 使用 Redis 获取值
    const value: string = (await this.redis.get('hello')) as string;
    return value;
  }
}
